<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/19
  Time: 8:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>购物车</title>
</head>
<body>
<%@include file="top.jsp"%>
<form action="" align="center">
    <table border="1" align="center" width="50%">
        <h1>购物车</h1><br>
        <c:if test="${empty sessionScope.cart}"></c:if>
        <c:choose>
            <c:when test="${empty sessionScope.cart}">
                <h1 style="color: red">你的购物车为空</h1><br>
            </c:when>
            <c:otherwise>
                <tr>
                    <td width="5%">序号</td>
                    <td width="10%">商品名称</td>
                    <td width="5%">价格</td>
                    <td width="2%">操作</td>
                </tr>
            </c:otherwise>
        </c:choose>
        <c:forEach items="${sessionScope.cart}" var="product" varStatus="status">
              <tr>
                  <td>${status.count}</td>
                  <td>${product.pname}</td>
                  <td>${product.shopPrice}</td>
                  <td><a href="${pageContext.request.contextPath}/removeCartServlet?pid=${product.pid}">删除</a></td>
              </tr>
        </c:forEach>
    </table>
</form>
<%@include file="foot.jsp"%>
</body>
</html>
